This example application demonstrates how you can use QPainter
to perform custom rendering in a widget. It turns the text editor from example 7 into an action shooter: When you click inside the editor with the mouse, bullet holes appear.
The crucial steps of this example are to override mousePressEvent(...)
to handle the user's clicks, and paintEvent(...)
to draw the bullets. See the top of main.py
for how these features work in detail.
To run this example yourself, please follow these instructions.